import Vue from "vue";
import VueRouter from "vue-router";

// const originalPush = VueRouter.prototype.push
// VueRouter.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch(err => err)
// }

// const HomePage = () => import('@/layout/HomePage.vue')
// const HomeBase = () => import('@/layout/HomeBase.vue')

// const BaseMy = () => import('@/views/base/BaseMy.vue')
// const BaseFind = () => import('@/views/base/BaseFind.vue')
// const BaseFriend = () => import('@/views/base/BaseFriend.vue')

// const BaseProp = () => import('@/views/basis/BaseProp.vue')
// const BaseDifference = () => import('@/views/basis/BaseDifference.vue')
// const BaseSlot = () => import('@/views/basis/BaseSlot.vue')
// const BaseTable = () => import('@/views/basis/BaseTable.vue')
// const BaseInstructions = () => import('@/views/basis/BaseInstructions.vue')
// const BaseMaintenance = () => import('@/views/basis/BaseMaintenance.vue')
// const BaseFather = () => import('@/views/basis/BaseFather.vue')

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        {
            redirect: 'page',
            path: '/', component: () => import('@/layout/HomePage.vue'),
            children: [
                { path: '/page', name: 'page', component: () => import('@/layout/HomeBase.vue') },
                { path: '/my', name: 'my', component: () => import('@/views/base/BaseMy.vue') },
                { path: '/find', name: 'find', component: () => import('@/views/base/BaseFind.vue') },
                { path: '/friend', name: 'friend', component: () => import('@/views/base/BaseFriend.vue') },

                { path: '/prop', name: 'prop', component: () => import('@/views/basis/BaseProp.vue') },
                { path: '/difference', name: 'difference', component: () => import('@/views/basis/BaseDifference.vue') },
                { path: '/slot', name: 'slot', component: () => import('@/views/basis/BaseSlot.vue') },
                { path: '/tables', name: 'tables', component: () => import('@/views/basis/BaseTable.vue') },
                { path: '/instructions', name: 'instructions', component: () => import('@/views/basis/BaseInstructions.vue') },
                { path: '/maintenance', name: 'maintenance', component: () => import('@/views/basis/BaseMaintenance.vue') },
                { path: '/notepad', name: 'notepad', component: () => import('@/views/basis/BaseNotepad.vue') },
                { path: '/father', name: 'father', component: () => import('@/views/basis/BaseFather.vue') },
            ]
        }
    ]
})

// 解决头部面包屑重复重复点击报错
const originalPush = router.push
router.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

export default router